<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	</head>
<body class="main">
	<div class="wrap add-shop">
	<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span><a href="#">首页</a> <span class="divider">>></span></li>
		    <li class="active">${addGroup}</li>
	    </ul>
		<form class="form-horizontal" method="post"
			enctype="multipart/form-data"
			action="${webRoot}group/addGroupInfo.do" id="groupInfo">
		 <div class="control-group">
		    <label class="control-label" for="goods_id">所属商铺</label>
		    <div class="controls">
				<select id="goods_id" name="goods_id">
				<#list listGoods as goodsEntity>
				  <option value="${goodsEntity.goods_id}">${goodsEntity.goods_Name}</option>
				 </#list>
				</select>
		    </div>
		  </div>	
		  <div class="control-group">
		    <label class="control-label" for="group_name">团购名称</label>
		    <div class="controls">
		      <input type="text" id="group_name" name="group_name">
		    </div>
		  </div>
		   <div class="control-group">
		    <label class="control-label" for="startTime">开始时间</label>
		    <div class="controls">
		      <input type="date" class="w120"  id="startTime" name="startTime">
		    </div>
		  </div>
		   <div class="control-group">
		    <label class="control-label" for="endTime">结束时间</label>
		    <div class="controls">
		      <input type="date" class="w120"  id="endTime" name="endTime">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="group_price">原价</label>
		    <div class="controls">
		      <input type="number" id="group_price" name="group_price">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="group_tuangouprice">团购价</label>
		    <div class="controls">
		      <input type="number" id="group_tuangouprice" name="group_tuangouprice">
		    </div>
		  </div>
		   <div class="control-group">
		    <label class="control-label" for="group_info">价格简介</label>
		    <div class="controls">
		      <textarea rows="2" id="group_info" name="group_info"></textarea>
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="group_context">团购简介</label>
		    <div class="controls">
		      <textarea rows="3" id="group_context" name="group_context"></textarea>
		    </div>
		  </div>
		  <div class="control-group">
				<label class="control-label" for="file">图片上传</label>
				<div class="controls">
					<input type="file" id="file" name="file">
					<div class="preview">
						<img src="">
					</div>
				</div>
			</div>  		    
		  <div class="control-group">
		    <div class="controls">
		      <button type="button" class="btn" onclick="checkContext()">确认添加</button>
		    </div>
		  </div>
		</form>			 	
	</div>			
	<script src="${webRoot}resources/js/jquery-1.9.1.min.js"></script>
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
    <script type="text/javascript">
        function getLabelList(){
        	var uplabel = $("#uplabel_id").val();
        	$.ajax({url:"${webRoot}goods/getLabelList.do?uplabelId="+uplabel,
			   type:"post",
			   cache:"false",
			   error : function() {
				   alert("系统繁忙，请稍后再试！");
				},
			   success:function(msg){
				   $("#labelId").html(msg);
			   }
			});
        }
        function checkContext(){
        	var groupName = $("#group_name").val();
        	if($.trim(groupName) == null ||$.trim(groupName) =="" ){
        		alert("团购名字不能为空！");
        		return;
        	}
        	var startTime = $("#startTime").val();
        	if($.trim(startTime) == null ||$.trim(startTime) =="" ){
        		alert("团购开始时间不能为空！");
        		return;
        	}
        	
        	var endTime = $("#endTime").val();
        	if($.trim(endTime) == null ||$.trim(endTime) =="" ){
        		alert("团购结束时间不能为空！");
        		return;
        	}
        	var group_price = $("#group_price").val();
        	if($.trim(group_price) == null ||$.trim(group_price) =="" ){
        		alert("团购原价不能为空！");
        		return;
        	}
        	var group_tuangouprice = $("#group_tuangouprice").val();
        	if($.trim(group_tuangouprice) == null ||$.trim(group_tuangouprice) =="" ){
        		alert("团购价不能为空！");
        		return;
        	}
        	var group_info = $("#group_info").val();
        	if($.trim(group_info) == null ||$.trim(group_info) =="" ){
        		alert("价格简介不能为空！");
        		return;
        	}
        	
        	var group_context = $("#group_context").val();
        	if($.trim(group_context) == null ||$.trim(group_context) =="" ){
        		alert("团购简介不能为空！");
        		return;
        	}
        	
        	var file = $("#file").val();
        	if($.trim(file) == null ||$.trim(file) =="" ){
        		alert("上传图片不能为空！");
        		return;
        	}
        	document.getElementById("groupInfo").submit();
        }
    </script>

</body>
</html>
